* {
  -webkit-touch-callout: none; /*系统默认菜单被禁用*/
  -webkit-user-select: none; /*webkit浏览器*/
  -khtml-user-select: none; /*早期浏览器*/
  -moz-user-select: none; /*火狐*/
  -ms-user-select: none; /*IE10*/
  user-select: none;
}

/* 添加loading样式 */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--loading-bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.spinner {
  border: 5px solid #fcfcfc;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 暗黑模式下的loading样式 */

.data-viewer {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  box-sizing: border-box;
  overflow: hidden;
  outline: none; /* 去除默认的焦点边框样式 */
  border: none;
}

.btn {
  padding: 4px 8px;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
}

.btn:hover {
  color: #40a9ff;
  border-color: #40a9ff;
}

.btn-primary {
  color: #fff;
  background: #1890ff;
  border-color: #1890ff;
}

.btn-primary:hover {
  color: #fff;
  background: #40a9ff;
  border-color: #40a9ff;
}

.chart-container {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.controls {
  padding: 16px 16px 8px 16px;
  border-top: 1px solid #f0f0f0;
  background-color: #fff;
  width: 100%;
  border-bottom: 1px solid rgba(30, 64, 175, 0.1);
  gap: 10px;
}

.controls .flex {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  row-gap: 6px;
}

/* 工具下拉菜单样式 */
.tools-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid rgba(30, 64, 175, 0.2);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 120px;
  z-index: 1000;
  margin-top: 4px;
  overflow: hidden;
}

.dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #1e3a8a;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(30, 64, 175, 0.1);
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: rgba(30, 64, 175, 0.05);
  color: #1e3a8a;
}

.dropdown-item-active {
  background: rgba(30, 64, 175, 0.1);
  color: #1e3a8a;
  font-weight: 600;
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
  color: inherit;
}

@media (max-width: 1024px) {
  /* 工具下拉菜单在小屏幕下的适配 */
  .dropdown-menu {
    min-width: 120px;
    margin-top: 2px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  }

  .dropdown-item {
    padding: 4px 8px;
    gap: 6px;
    font-size: 12px;
  }

  .dropdown-item svg {
    width: 14px;
    height: 14px;
  }
}

/* 添加键盘操作提示 */
.keyboard-hint {
  margin-top: 10px;
  font-size: 13px;
  color: #888;
  text-align: center;
  width: 100%;
}

.polygon-data {
  padding: 24px;
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.polygon-info {
  margin-bottom: 16px;
}

.polygon-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* 添加回原先的一些重要样式 */
.line {
  fill: none;
  stroke-width: 1.5;
}

.grid line {
  stroke: #f0f0f0;
  stroke-opacity: 0.7;
  shape-rendering: crispEdges;
}

.grid path {
  stroke-width: 0;
}

.cursor-line {
  pointer-events: none;
}

.cursor-point {
  pointer-events: none;
}

.axis {
  font-size: 12px;
}

.axis path,
.axis line {
  fill: none;
  stroke: #000;
  shape-rendering: crispEdges;
}

.zoom-selection {
  pointer-events: none;
}

.cursor-line-1,
.cursor-line-2 {
  pointer-events: all;
}

.polygon-selection {
  pointer-events: fill; /* 从none改为fill，允许点击多边形区域 */
}

.polygon-point {
  cursor: pointer;
  pointer-events: all; /* 确保点可点击 */
}

.temp-line {
  pointer-events: none;
}

.discrete-group {
  pointer-events: none;
}

.discrete-label {
  pointer-events: none;
  font-size: 10px;
}

.discrete-band {
  pointer-events: none;
}

.discrete-band:hover {
  opacity: 1;
}
.discrete-band-hover {
  opacity: 0.85 !important;
  filter: brightness(1.2);
}

.zoom-window {
  pointer-events: none;
}

.zoom-handle {
  pointer-events: none;
}

.param-section {
  margin-bottom: 10px;
  overflow: hidden;
}

input[type="color"] {
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  cursor: pointer;
}

input[type="number"] {
  height: 26px;
  width: 50px;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
  padding: 0 5px;
  font-size: 0.875rem;
}

select {
  height: 26px;
  width: 80px;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
  padding: 0 5px;
  font-size: 0.875rem;
}

/* 模态框样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1100;
  overflow: hidden;
}

.modal-content {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: 90%;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-fade-in 0.3s ease;
}

@keyframes modal-fade-in {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: bold;
  color: #1e3a8a;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.45);
  padding: 0;
  /* transition: color 0.3s; */
}

.close-btn:hover {
  color: rgba(0, 0, 0, 0.85);
}

.modal-body {
  padding: 16px 24px;
  overflow-y: auto;
  max-height: calc(90vh - 130px); /* 减去header和footer的高度 */
}

.modal-footer {
  padding: 10px 16px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.view-btn-cancel,
.view-btn-primary {
  height: 36px;
  font-size: 0.875rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(100, 116, 139, 0.3);
  color: rgba(100, 116, 139, 0.9);
}

.view-btn-cancel:hover {
  border-color: rgba(107, 114, 128, 0.5);
  background-color: rgba(107, 114, 128, 0.05);
  color: rgba(75, 85, 99, 1);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.view-btn-cancel:active {
  background-color: rgba(107, 114, 128, 0.1);
  border-color: rgba(107, 114, 128, 0.6);
  color: rgba(55, 65, 81, 1);
  transform: translateY(0);
  box-shadow: none;
}

.view-btn-primary {
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #2563eb;
}

.view-btn-primary:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.view-btn-primary:disabled {
  background: rgba(100, 116, 139, 0.1);
  border-color: rgba(100, 116, 139, 0.2);
  color: rgba(100, 116, 139, 0.5);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.settings-list {
  display: flex;
  flex-direction: column;
}

.no-data-message {
  color: #888;
  font-size: 14px;
  margin-top: 4px;
  text-align: center;
}

/* 添加参数Y轴样式 */
.param-y-axis .domain {
  stroke: #999;
  stroke-width: 1px;
}

.param-y-axis text {
  fill: #555;
}

.param-y-axis .axis-title {
  font-weight: bold;
  fill: #333;
}

.y-axis-background {
  stroke: #eee;
  stroke-width: 1px;
}

.param-setting-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  /* border-bottom: 1px solid #f0f0f0; */
  /* margin-bottom: 8px; */
}

.setting-param-name {
  font-size: 14px;
  width: 140px;
  word-break: break-all;
}

.control-group {
  display: flex;
  flex-direction: row;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

.control-group label {
  font-size: 14px;
  color: #666;
}

.control-group input {
  width: 80px;
}

.control-group select {
  width: 80px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.y-axis-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-input {
  width: 60px;
  height: 26px;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
  padding: 0 5px;
  font-size: 0.875rem;
}

.reset-btn {
  background: transparent;
  border: none;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  padding: 0 2px;
}

.reset-btn:hover {
  color: #40a9ff;
}

.tech-btn {
  font-size: 15px;
}

/* 1024*768分辨率适配 */
@media (max-width: 1024px) {
  .data-viewer {
    font-size: 12px;
  }

  .controls {
    padding: 8px;
    gap: 4px;
  }

  .controls .flex {
    gap: 4px;
    row-gap: 4px;
    width: 100%;
  }

  .tech-btn svg {
    width: 12px;
    height: 12px;
  }

  .tech-btn {
    padding: 4px 8px;
    height: 24px;
    font-size: 12px;
    white-space: nowrap;
  }

  .keyboard-hint {
    font-size: 10px;
  }

  .modal-content {
    width: 90%;
    max-width: 960px;
    .control-group label {
      font-size: 11px;
    }
  }

  .modal-header {
    padding: 10px 16px;
  }

  .modal-header h3 {
    font-size: 14px;
  }

  /* 视图设置弹窗内部适配 */
  .param-setting-row {
    gap: 6px;
    padding: 8px;
  }

  .control-group {
    flex-direction: row;
    align-items: center;
  }

  .y-axis-range {
    flex-direction: row;
    gap: 4px;
  }

  .range-input {
    width: 70px;
  }

  /* 图表区域内部适配 */
  .chart-container {
    height: calc(100% - 50px);
  }

  .setting-param-name {
    font-size: 12px;
    width: 100px;
    word-break: break-all;
  }
}

/* 游标标签样式 */
.cursor-label-group {
  pointer-events: all;
}

.cursor-label-bg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
  transition: all 0.2s ease;
}

.cursor-label-bg:hover {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
  stroke-width: 1.5;
}

.cursor-label-text {
  pointer-events: none;
  text-anchor: start;
  dominant-baseline: central;
}

/* 暗黑模式下的游标标签样式 */
.dark-mode .cursor-label-bg {
  fill: rgba(30, 30, 30, 0.9) !important;
  stroke-width: 1 !important;
}

.dark-mode .cursor-label-bg:hover {
  fill: rgba(40, 40, 40, 0.95) !important;
  stroke-width: 1.5 !important;
}

/* 视图设置模态框深色模式样式 */
.dark-mode .view-btn-primary:disabled {
  background: rgba(100, 116, 139, 0.1);
  border-color: rgba(100, 116, 139, 0.2);
  color: rgba(100, 116, 139, 0.5);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.dark-mode input[type="color"]:focus,
.dark-mode input[type="number"]:focus,
.dark-mode select:focus {
  border-color: #1890ff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.dark-mode .no-data-message {
  color: #999999;
}

.dark-mode .param-section {
  border-bottom-color: #333333;
}

.dark-mode .param-setting-row {
  border-bottom-color: #333333;
}

.dark-mode .checkbox-label span {
  color: #cccccc;
}

.dark-mode .checkbox-label input[type="checkbox"] {
  accent-color: #1890ff;
}

.dark-mode .y-axis-range label {
  color: #cccccc;
}

.dark-mode .range-input {
  background-color: #333333;
  border-color: #444444;
  color: #e0e0e0;
}

.dark-mode .range-input:focus {
  border-color: #1890ff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.dark-mode .reset-btn {
  color: #999999;
}

.dark-mode .reset-btn:hover {
  color: #1890ff;
}

/* 工具下拉菜单深色模式样式 */
.dark-mode .dropdown-menu {
  background: #1e1e1e;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.dark-mode .dropdown-item {
  color: #e0e0e0;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .dropdown-item:hover {
  background: rgba(24, 144, 255, 0.1);
  color: #64b5f6;
}

.dark-mode .dropdown-item-active {
  background: rgba(24, 144, 255, 0.2);
  color: #64b5f6;
}

.dark-mode .dropdown-item svg {
  color: inherit;
}
